﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using System.Configuration;
using Castle.DynamicProxy;
using CNKI.TPI.Web.Base;
using CNKI.TPI.Web.Search.IBLL;
using CNKI.TPI.Web.Search.IDAO;
using CNKI.TPI.Web.Search.Model;
using System.Text.RegularExpressions;

namespace CNKI.TPI.Web.UI.Controllers.Submit
{
   
    public class AddKeyController : BaseController
    {
        int dbID = 0;
        string dbCode = "";
        string dbName = "";
        string sysid = "";
        string fieldname = "";
        string fieldvalue = "";

        public ActionResult Index()
        {
            //接收参数
            LoadParameter();

            string strDefaultValue = fieldvalue;
            string[] strArrDefaultValue = strDefaultValue.Split(new char[] { ';', '；' }, StringSplitOptions.RemoveEmptyEntries);
            List<SelectListItem> items = new List<SelectListItem>();
            for (int i = 0; i < strArrDefaultValue.Length; i++)
            {
                items.Add(new SelectListItem { Text = strArrDefaultValue[i], Value = strArrDefaultValue[i] });
            }
            var selectlist = new SelectList(items);
            ViewData["listKeys"] = items;
            return View();
        }


        private void LoadParameter()
        {
            if (!String.IsNullOrEmpty(Request["dbID"]))
            {
                dbID = int.Parse(Request["dbID"]);
                ViewBag.dbID = dbID;
            }
            if (!String.IsNullOrEmpty(Request["dbCode"]))
            {
                dbCode = Request["dbCode"];
                ViewBag.dbCode = dbCode;
            }
            if (!String.IsNullOrEmpty(Request["dbName"]))
            {
                dbName = Server.UrlDecode(Request["dbName"].ToString());
                ViewBag.dbName = dbName;
            }
            if (!String.IsNullOrEmpty(Request["sysid"]))
            {
                sysid = Request["sysid"];
                ViewBag.sysid = sysid;
            }
            if (!String.IsNullOrEmpty(Request["fieldname"]))
            {
                fieldname = Server.UrlDecode(Request["fieldname"].ToString());
                ViewBag.fieldname = fieldname;
            }
            if (!String.IsNullOrEmpty(Request["fieldvalue"]))
            {
                fieldvalue = Server.UrlDecode(Request["fieldvalue"].ToString());
                ViewBag.fieldvalue = fieldvalue;
            }
        }

    }
}
